#define _CRT_SECURE_NO_WARNINGS 1
#include"Sort.h"
#include"Stack.h"
void PrintArray(int* a, int len)
{
	for (int i = 0; i < len; i++)
	{
		printf("%d ", a[i]);
	}
	printf("\n");
}

void TestBubbleSort()
{
	int a[] = { 4,3,5,2,8,6,0,9,10 };
	int len = sizeof(a) / sizeof(int);
	BubbleSort(a, len);
	PrintArray(a, len);
}

void TestQuickSort()
{
	int a[] = { 4,3,5,2,8,6,0,9,10 };
	int len = sizeof(a) / sizeof(int);
	QuickSort(a,0,len - 1);
	PrintArray(a, len);
}

void TestQuickSortNonR()
{
	int a[] = { 4,3,5,2,8,6,0,9,10 };
	int len = sizeof(a) / sizeof(int);
	QuickSortNonR(a, 0, len - 1);
	PrintArray(a, len);
}
void TestInsertSort()
{
	int a[] = { 4,3,5,2,8,6,0,9,10 };
	int len = sizeof(a) / sizeof(int);
	InsertSort(a, len);
	PrintArray(a, len);
}

void TestShellSort()
{
	int a[] = { 4,3,5,2,8,6,0,9,10 };
	int len = sizeof(a) / sizeof(int);
	ShellSort(a, len);
	PrintArray(a, len);
}

void TestSelectSort()
{
	int a[] = { 5,4,3,2,1};
	int len = sizeof(a) / sizeof(int);
	SelectSort(a, len);
	PrintArray(a, len);
}

void TestHeapSort()
{
	int a[] = { -74,48,-20,2,10,-84,-5,-9,11,-24,-91,2,-71,64,63,80,28,-30,
		-58,-11,-44,-87,-22,54,-74,-10,-55,-28,-46,29,10,50,-72,34,26,25,8
		,51,13,30,35,-8,50,65,-6,16,-2,21,-78,35,-13,14,23,-3,26,-90,86,25,
		-56,91,-13,92,-25,37,57,-20,-69,98,95,45,47,29,86,-28,73,-44,-46,65,
		-84,-96,-24,-12,72,-68,93,57,92,52,-45,-2,85,-63,56,55,12,-85,77,-39 };
	int len = sizeof(a) / sizeof(int);
	HeapSort(a, len);
	PrintArray(a, len);
}

void TestMergeSort()
{
	int a[] = { 11,3,5,8,6,0,9,10,2,11,35,1,0 };
	int len = sizeof(a) / sizeof(int);
	MergeSort(a, len);
	PrintArray(a, len);
}

void TestMergeSortNonR()
{
	int a[] = { 11,3,5,8,6,0,9,10,2,11,35,1,0};
	int len = sizeof(a) / sizeof(int);
	MergeSortNonR(a, len);
	PrintArray(a, len);
}

void TestMergeSortNonR2()
{
	int a[] = { 11,3,5,8,6,0,9,10,2,11,35,1,0 };
	int len = sizeof(a) / sizeof(int);
	MergeSortNonR2(a, len);
	PrintArray(a, len);
}

void TestCountSort()
{
	int a[] = { 11,3,5,8,6,0,9,10,2,11,35,1,0 };
	int len = sizeof(a) / sizeof(int);
	CountSort(a, len);
	PrintArray(a, len);
}
int main()
{

	//TestInsertSort();
	//TestSelectSort();
	//TestBubbleSort();
	TestHeapSort();
	//TestQuickSort();
	//TestQuickSortNonR();
	//TestMergeSort();
	//TestMergeSortNonR();
	//TestMergeSortNonR2();
	//TestCountSort();
	return 0;
}